package net.csdn.business.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author wanghang
 * @version 1.0
 * @date 2022/7/9 18:11
 */
public interface UserEnum {

    @Getter
    @AllArgsConstructor
    enum SendEmailTypeEnum {
        /**
         * 1-重置密码 2-验证邮箱 3-修改邮箱 4-MFA 验证
         */
        RESET_PASSWORD(1, "RESET_PASSWORD", "重置密码"),
        VERIFY_EMAIL(2, "VERIFY_EMAIL", "验证邮箱"),
        CHANGE_EMAIL(3, "CHANGE_EMAIL", "修改邮箱"),
        MFA_VERIFY(4, "MFA_VERIFY", "MFA 验证"),
        LOGIN_VERIFY_CODE(5, "LOGIN_VERIFY_CODE", "登录验证");

        final Integer code;
        final String desc;
        final String descCn;

        public static SendEmailTypeEnum findByCode(Integer code) {
            for (SendEmailTypeEnum enumInstance : SendEmailTypeEnum.values()) {
                if (enumInstance.getCode() == code) {
                    return enumInstance;
                }
            }
            return null;
        }
    }

}
